def pre(target, source, env):
    pass
def post(target, source, env):
    pass
def build(target, source, env):
    open(str(target[0]), 'wb').write(b'build()\n')
env = Environment()
AddPreAction('dir', pre)
AddPostAction('dir', post)
env.Command('dir/file', [], build)
